package com.handydata.antifraud.service.impl;

import java.util.UUID;

import lombok.extern.slf4j.Slf4j;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.handydata.antifraud.bo.dataBaiRongInfo.DataBaiRongInfoReqBO;
import com.handydata.antifraud.bo.dataBaiRongInfo.DataBaiRongInfoResBO;
import com.handydata.antifraud.common.exception.DataBaiRongInfoExCode;
import com.handydata.antifraud.dao.DataBaiRongInfoDao;
import com.handydata.antifraud.entity.DataBaiRongInfoDO;
import com.handydata.antifraud.service.DataBaiRongInfoService;
import com.handydata.common.convert.CommonBeanConvertor;
import com.handydata.common.exception.SysException;
import com.handydata.common.service.AbsService;

@Service
@Slf4j
public class DataBaiRongInfoServiceImpl extends AbsService  implements DataBaiRongInfoService{

	@Autowired
	private DataBaiRongInfoDao dataBaiRongInfoDao;
	
	@Transactional
	@Override
	public DataBaiRongInfoResBO createDataBaiRongInfo(DataBaiRongInfoReqBO req) {
		DataBaiRongInfoResBO res = new DataBaiRongInfoResBO();
		try {
			DataBaiRongInfoDO entity = CommonBeanConvertor.convert(req, DataBaiRongInfoDO.class);
			entity.setId(UUID.randomUUID().toString().replace("-", ""));	
			long status = dataBaiRongInfoDao.insert(entity);
			if(status == 0) {
				res.setExCode(DataBaiRongInfoExCode.SYS_NO_ENTITY_CREATED);
			} else {
				res.setExCode(DataBaiRongInfoExCode.SUCCESS);
			}
		} catch (Exception e) {
			log.error("Create new entity {} get into error", req, e);
			throw new SysException(DataBaiRongInfoExCode.SYS_CREATE_ENTITY_ERROR);
		}
		return res;
	}

	@Override
	public DataBaiRongInfoResBO modifyDataBaiRongInfo(DataBaiRongInfoReqBO req)
			throws SysException {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public DataBaiRongInfoResBO deleteDataBaiRongInfo(DataBaiRongInfoReqBO req)
			throws SysException {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public DataBaiRongInfoResBO queryDataBaiRongInfo(DataBaiRongInfoReqBO req)
			throws SysException {
		// TODO Auto-generated method stub
		return null;
	}

}
